<?php
/**
 * @link http://www.nao.com/
 * @copyright NAO集团有限公司
 * @license http://www.tangzhangming.com/framework/license/
 */
namespace Framework\Queue;


class Job
{

	public function __construct($config = [])
	{
		foreach ($config as $key => $value) {
			$this->$key = $value;
		}
		$this->init();
	}

	public function init(){}


	//分发任务
	static public function dispatch($config)
	{
		// Yii::$app->queue->push(new DownloadJob([
		//     'url' => 'http://example.com/image.jpg',
		//     'file' => '/tmp/image.jpg',
		// ]));


		$job_class_name = get_called_class();
		return $job = new $job_class_name($config);
	}

}